﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cn
{
     /// <summary>
     /// 动态调用WCF
     /// </summary>
      public static class Wcf
       {
           /// <summary>
           /// 创建wcf请求
           /// </summary>
           /// <typeparam name="T">类型</typeparam>
           /// <param name="endpointName">链接地址</param>
           /// <returns></returns>
           public static T Create<T>(string endpointName)
           {
               if (string.IsNullOrEmpty(endpointName))
               {
                   throw new ArgumentNullException("链接地址不能为空！");
               }
               return (T)(new ServiceRealProxy<T>(endpointName).GetTransparentProxy());
           }      
       }
}
